//
//  YsCloudFileDownloadManager.h
//  YsCloudFileManageSDK
//
//  Created by 宋宏康 on 2020/2/27.
//

#import <Foundation/Foundation.h>
#import "YsCloudFileDownloadModel.h"
#import "YsCloudFileManagerHeader.h"

@interface YsCloudFileDownloadManager : NSObject

/// 单例对象
+ (instancetype)shareDownloadManger;

/// 所有下载模型的数组
@property (nonatomic, strong) NSMutableArray *downloadsArray;

/// 最大线程数 默认最大并发数5
@property (nonatomic, assign) int maxDownloadTaskCount;

/// 开始下载
/// @param downloadUrl 下载的URL
/// @param para 参数
/// @param requestMethod get/post
/// @param customCacheName 下载缓存文件的名字
/// @param lastPathComponent 下载缓存文件的后缀
- (void)downloadWithUrl:(NSString *)downloadUrl
               withPara:(NSString *)para
                withMethod:(NSString *)requestMethod
       withCustomCacheName:(NSString *)customCacheName
  withLastPathComponent:(NSString *)lastPathComponent;

/// 开始单个下载的任务
/// @param model 下载模型
- (void)beginDownloadWithModel:(YsCloudFileDownloadModel *)model;

/// 取消任务 通过文件名取消任务
/// @param name 文件名
- (void)cancelTask:(YsCloudFileDownloadModel *)name;

/// 暂停任务
/// @param downloadUrl 断点下载的URL
- (void)suspendWithDownloadUrl:(NSString *)downloadUrl DEPRECATED_ATTRIBUTE;

/// 暂停任务
/// @param downloadName 文件名
- (void)suspendWithDownloadName:(NSString *)downloadName;

/// 通过URL恢复任务
/// @param downloadUrl 下载的URL
- (void)resumeWithdownloadUrl:(NSString *)downloadUrl;

/// 通过文件名恢复任务
/// @param downloadName 下载的URL
- (void)resumeWithdownloadName:(NSString *)downloadName;


/// 通过文件的下载任务模型回复任务
/// @param downloadModel  下载任务模型
- (void)resumeWithdownloadModel:(YsCloudFileDownloadModel *)downloadModel;

/// 暂停所有的网络下载任务
- (void)suspendAllRequest;

/// 恢复所有的任务由于APP杀死的下载任务
- (void)resumeAllRequestBecauseofAppKill;
@end

